const mixinBeforeReqData = (mixins) => {
  mixins.push({
    props: ['beforeData'],
    data() {
      return {
        data: {
          before: this.beforeData
        }
      }
    }
  })

  return mixins
}

const mixinAfterReqData = (mixins, data) => {
  mixins.push({
    data() {
      return {
        data
      }
    },
    computed: {
      afterRequestLoading() {
        return this.data.after.afterRequestLoading
      },
      afterRequestStatus() {
        return this.data.after.afterRequestStatus
      }
    },
    watch: {
      afterRequestLoading() {
        console.log(`后置预加载数据的结果为: ${this.afterRequestStatus}，数据详情请通过 vm.data.after 查看`)
      }
    }
  })

  return mixins
}

export {
  mixinBeforeReqData,
  mixinAfterReqData
}
